
public class Rectangle extends Shape {

	//属性
	//宽
	private double width;
	//高
	private double height;
	
	
	@Override
	public double calArea() {
		setArea( width * height);
		return getArea();
	}

	@Override
	public double calPer() {
		setPer(2*width+2*height);
		return  getPer();
	}

	@Override
	public void showAll() {
		System.out.println("矩形宽为"+width+"高为"+height+"面积为"+ calArea()+"周长为"+ calPer());

	}
	
	//构造方法

	/**
	 * 
	 */
	public Rectangle() {
		super();
		// TODO Auto-generated constructor stub
	}

	

	
	/**
	 * @param width 宽
	 * @param height 高
	 * @param color 颜色
	 */
	public Rectangle(double width, double height,String color) {
		super(color);
		this.width = width;
		this.height = height;
	}

	
	
//get&set
	
	public double getWidth() {
		return width;
	}

	public void setWidth(double width) {
		this.width = width;
	}

	public double getHeight() {
		return height;
	}

	public void setHeight(double height) {
		this.height = height;
	}

}
